<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/bluetooth/resources/bluetooth-test.js"></script>
<script src="/bluetooth/resources/bluetooth-fake-devices.js"></script>
<script>
'use strict';
const test_desc = 'Trying to write more than 512 bytes should return an error.'
let characteristic;

bluetooth_test(() => getMeasurementIntervalCharacteristic()
    .then(({characteristic}) => assert_promise_rejects_with_message(
        characteristic.writeValue(new Uint8Array(513 /* length */)),
        new DOMException(
            'Failed to execute \'writeValue\' on ' +
            '\'BluetoothRemoteGATTCharacteristic\': ' +
            'Value can\'t exceed 512 bytes.',
            'InvalidModificationError'
        ), 'Value passed was too long.')),
    test_desc);
</script>
